package com.example.dao;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.example.entity.Insurance;
import com.example.entity.User;

public interface InsuranceRepository extends JpaRepository<Insurance, Long> {

	List<Insurance> findByProductId(Long productId);
	
	Insurance findById(Long productId);
	
	@Transactional
	@Modifying
	@Query(value="update insurance i set i.cal_Formula=?1, i.formula_desc=?2 where i.id=?3",nativeQuery=true)//原生sql语句
	int setCalculator(String formula, String formulaDesc, long id);
	
}
